home *** CD-ROM | disk | FTP | other *** search
/ EuroCD 3 / EuroCD 3.iso / Programming / BlitzBasic / TRITONBLITZ / Demos / toolmanager1.bb2 < prev    next >
Encoding:
Text File  |  1998-06-24  |  5.0 KB  |  222 lines

  1. ;/*
  2. ; *  Triton - The object oriented GUI creation system For the AMIGA
  3. ; *  Written by Stefan Zeiger in 1993-1995
  4. ; *
  5. ; *  (c) 1993-1995 by Stefan Zeiger
  6. ; *  You are hereby allowed To Use this source OR parts
  7. ; *  of it For creating programs For AmigaOS which Use the
  8. ; *  Triton GUI creation system. All other rights reserved.
  9. ; *
  10. ; *  Toolmanager1.c - Looks like the original ToolManager
  11. ; *
  12. ; */
  13.  
  14. NoCli:WBStartup
  15.  
  16. ; useful Runtime-Error-Routine which closes all windows if a error
  17. ; appears. So you don't need to restart your machine every time :-)
  18.  
  19. SetErr
  20.  
  21.   ErrFail
  22.   If project.l Then TR_CloseProject_ project
  23.   If application.l Then TR_DeleteApp_ application
  24.   End
  25.  
  26. End SetErr
  27.  
  28. INCLUDE "blitz2:bbincludes/libraries/triton.bb2"
  29.  
  30. ; this newtype is needed for the ListView-Items just as
  31. ; for GTListviews.
  32.  
  33. NEWTYPE .LVItem
  34.   num.w
  35.   text$
  36. End NEWTYPE
  37.  
  38. Dim cycle_entries.l(8)
  39. Dim List LVNodes.LVItem(9)
  40.  
  41. InitTagList 1,200           ; this is our window taglist
  42. InitTagList 2,10            ; this is our application taglist
  43.  
  44. ; set the cycle gadget entries
  45.  
  46. cycle_entries(1)=Null("Exec")
  47. cycle_entries(2)=Null("Image")
  48. cycle_entries(3)=Null("Sound")
  49. cycle_entries(4)=Null("Menu")
  50. cycle_entries(5)=Null("Icon")
  51. cycle_entries(6)=Null("Docs")
  52. cycle_entries(7)=Null("Access")
  53. cycle_entries(8)=0
  54.  
  55. ResetList LVNodes()
  56.  
  57. ; fill the listview
  58.  
  59. If AddItem(LVNodes())
  60.   LVNodes()\text="2024View"
  61.   If AddItem(LVNodes())
  62.     LVNodes()\text="Add to archive"
  63.     If AddItem(LVNodes())
  64.       LVNodes()\text="Deletetool"
  65.       If AddItem(LVNodes())
  66.         LVNodes()\text="Edit text"
  67.         If AddItem(LVNodes())
  68.           LVNodes()\text="Env"
  69.           If AddItem(LVNodes())
  70.             LVNodes()\text="Exchange"
  71.             If AddItem(LVNodes())
  72.               LVNodes()\text="Multiview"
  73.             EndIf
  74.           EndIf
  75.         EndIf
  76.       EndIf
  77.     EndIf
  78.   EndIf
  79. EndIf
  80.  
  81. ResetList LVNodes()
  82.  
  83. ; tell TRITON Prefs what this application is about
  84.  
  85. Use TagList 2
  86.  
  87. AddTags #TRCA_Name,Null("ToolManagerGUIDemo1")
  88. AddTags #TRCA_LongName,Null("ToolManager-GUI Demo 1")
  89. AddTags #TRCA_Info,Null("Looks like the original")
  90. AddTags #TAG_END,0
  91.  
  92. ; create our window layout
  93.  
  94. Use TagList 1
  95.  
  96. AddTags !WindowID{1},!WindowPosition{#TRWP_BELOWTITLEBAR}
  97. AddTags !WindowTitle{Null("ToolManager GUI demo 1")}
  98. AddTags !WindowFlags{#TRWF_NOSIZEGADGET OR #TRWF_NODELZIP OR #TRWF_NOZIPGADGET OR #TRWF_NOESCCLOSE}
  99. AddTags !WindowBackfillNone
  100.  
  101. AddTags !VertGroupA
  102. AddTags   !Space
  103. AddTags   !HorizGroupAC
  104. AddTags     !Space
  105. AddTags       !TextID{Null("_Object Type"),1}
  106. AddTags       !Space
  107. AddTags       !CycleGadget{&cycle_entries(1),0,1}
  108. AddTags       !Space
  109. AddTags     !EndGroup
  110. AddTags   !Space
  111.  
  112. AddTags   !HorizGroupAC
  113. AddTags     !Space
  114. AddTags     !VertGroupAC
  115. AddTags       !CenteredTextID{Null("Object List"),2}
  116. AddTags       !Space
  117.  
  118. ; this seems to be a little hackish as you access directly an
  119. ; list index but it works 100%. Don't forget to sub 36!
  120.  
  121. AddTags       !ListSSCN{&LVNodes(0)-36,2,0,0}
  122. AddTags     !EndGroup
  123.  
  124. AddTags     !Space
  125. AddTags     !VertGroupA
  126. AddTags       !TextN{Null("")}
  127. AddTags       !Space
  128. AddTags       !Button{Null("Top"),3}
  129. AddTags       !Space
  130. AddTags       !Button{Null("Up"),4}
  131. AddTags       !Space
  132. AddTags       !Button{Null("Down"),5}
  133. AddTags       !Space
  134. AddTags       !Button{Null("Bottom"),6}
  135. AddTags       !Space
  136. AddTags       !Button{Null("So_rt"),7}
  137. AddTags     !EndGroup
  138. AddTags     !Space
  139. AddTags   !EndGroup
  140. AddTags   !Space
  141. AddTags   !HorizGroupEA
  142. AddTags     !Space
  143. AddTags     !Button{Null("_New..."),8}
  144. AddTags     !Space
  145. AddTags     !Button{Null("_Edit..."),9}
  146. AddTags     !Space
  147. AddTags     !Button{Null("Co_py"),10}
  148. AddTags     !Space
  149. AddTags     !Button{Null("Remove"),11}
  150. AddTags     !Space
  151. AddTags   !EndGroup
  152.  
  153. AddTags   !Space
  154. AddTags   !HorizGroupEA
  155. AddTags     !Space
  156. AddTags     !Button{Null("_Save"),12}
  157. AddTags     !Space
  158. AddTags     !Button{Null("_Use"),13}
  159. AddTags     !Space
  160. AddTags     !Button{Null("_Test"),14}
  161. AddTags     !Space
  162. AddTags     !Button{Null("_Cancel"),15}
  163. AddTags     !Space
  164. AddTags   !EndGroup
  165. AddTags   !Space
  166. AddTags !EndGroup
  167. AddTags #TAG_END,0
  168.  
  169. ; ----------------------------------------------------------------
  170. ;         Here starts the main routine
  171. ; ----------------------------------------------------------------
  172.  
  173. ; never forget to set the right taglist !!
  174.  
  175. Use TagList 2
  176.  
  177. application.l=TR_CreateApp_(TagList)    ; no need for .TR_App anymore
  178.  
  179. If (application)
  180.  
  181.   Use TagList 1     ; set again the right taglist!
  182.  
  183.   project.l=TR_OpenProject_(application,TagList)
  184.  
  185.   If (project)
  186.     user_closed=0
  187.  
  188.       While (user_closed=0)
  189.  
  190.         TR_Wait_ application,0
  191.  
  192.         *trmsg.TR_Message=TR_GetMsg_(application)
  193.  
  194.         While (*trmsg)
  195.  
  196.           If (*trmsg\trm_Project=project)
  197.             Select *trmsg\trm_Class
  198.  
  199.               Case #TRMS_CLOSEWINDOW
  200.                 user_closed=True
  201.               End Select
  202.           EndIf
  203.  
  204.           TR_ReplyMsg_ *trmsg
  205.  
  206.           *trmsg=TR_GetMsg_(application)
  207.         End While
  208.       End While
  209.     TR_CloseProject_ project
  210.   Else
  211.     NPrint "Unable to create the project"
  212.   EndIf
  213.  
  214.     TR_DeleteApp_ application
  215.  
  216. Else
  217.   NPrint "Unable to create application"
  218. EndIf
  219.  
  220. End
  221.  
  222.